
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Pubs.Domain.Entities
{
    public partial class Employee : IEntity
    {
        protected static EmployeeBroker broker;
        public static EmployeeBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new EmployeeBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Employee()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected string _EmpId;
        public string EmpId
        {
            get{ return _EmpId; }
            set{ _EmpId=value; }
        }
        
        protected string _Fname;
        public string Fname
        {
            get{ return _Fname; }
            set{ _Fname=value; }
        }
        
        protected string _Minit;
        public string Minit
        {
            get{ return _Minit; }
            set{ _Minit=value; }
        }
        
        protected string _Lname;
        public string Lname
        {
            get{ return _Lname; }
            set{ _Lname=value; }
        }
        
        protected System.Int16? _JobId;
        public System.Int16? JobId
        {
            get{ return _JobId; }
            set{ _JobId=value; }
        }
        
        protected byte _JobLvl;
        public byte JobLvl
        {
            get{ return _JobLvl; }
            set{ _JobLvl=value; }
        }
        
        protected string _PubId;
        public string PubId
        {
            get{ return _PubId; }
            set{ _PubId=value; }
        }
        
        protected DateTime? _HireDate;
        public DateTime? HireDate
        {
            get{ return _HireDate; }
            set{ _HireDate=value; }
        }
        
        
        
        
        
        // Many-To-One: jobs.job_id
        protected Job _Job;
        public Job Job
        {
            get{ return _Job; }
            set{ _Job=value; }
        }
        
        // Many-To-One: pub_info.pub_id
        protected Pubinfo _Pubinfo;
        public Pubinfo Pubinfo
        {
            get{ return _Pubinfo; }
            set{ _Pubinfo=value; }
        }
        
        // Many-To-One: publishers.pub_id
        protected Publisher _Publisher;
        public Publisher Publisher
        {
            get{ return _Publisher; }
            set{ _Publisher=value; }
        }
                
        
        
        
        #endregion
    }
    
    #region EmployeeBroker

    public partial class EmployeeBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Employee); }
        }
        
        public Employee GetByID(object id)
        {
            return (Employee)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
